package file;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import data.Data;

public class File2DataList {
	
	List<Data> list = new ArrayList<Data>();
	
	public File2DataList(String file, String spliter) throws IOException{
		BufferedReader br = new BufferedReader(new FileReader(file));
		String line;
		while((line = br.readLine()) != null){
			String[] fields = line.split(spliter);
			int uid = Integer.parseInt(fields[0]);
			short iid = Short.parseShort(fields[1]);
			byte rat = Byte.parseByte(fields[2]);
			
			list.add(new Data(uid,iid,rat));
		}
		br.close();
	}

	public List<Data> getList() {
		return list;
	}

}
